<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

$BASE_DOMAIN = str_replace(array('http://', 'HTTP://'), '', Config::get('app.url'));
//$LOCALE = $url;

//sub-domain my or admin
Route::group(array('domain' => "{subDomain}.".$BASE_DOMAIN), function() {
	
	global $BASE_DOMAIN;
	
	Route::get('welcome', function($subDomain){
		$ctrl = new Org\JiwaNala\Controllers\MY\HomeController;
		return $ctrl->welcome();
	});
	
	Route::get('/', function($subDomain){
		$URI = Request::path();
		return Redirect::to( URL::to('welcome') );
	});
});

//sub-domain none
Route::group(array('domain' => $BASE_DOMAIN), function() {

	Route::get('/', function(){
		$ctrl = new Org\JiwaNala\Controllers\WWW\HomeController;
		return $ctrl->showWelcome();
	});

});